#include "widget2.h"
#include "ui_widget2.h"


Widget2::Widget2(FlightBookingSystem& system,QWidget *parent)
    :bookingSystem(system),
    QWidget(parent),
    ui(new Ui::Widget2)
{
    ui->setupUi(this);
}

Widget2::~Widget2()
{
    delete ui;
}

void Widget2::on_pushButton_determine_clicked()
{
    this->close();
    bookingSystem.bookTicket(flightNumber,quantity);
}


void Widget2::on_pushButton_cancel_clicked()
{
    emit this->back();
}


void Widget2::on_lineEdit1_textChanged(const QString &arg1)
{
    string s=arg1.toStdString();
    this->flightNumber=s;
}


void Widget2::on_lineEdit2_textChanged(const QString &arg2)
{
    int s=arg2.toInt();
    this->quantity=s;
}
